<extend name="./public/frame.html"/>
<block name="content">
    <style>
        .layui-form-label{width: 12%;}
        .layui-input-block{margin-left: 12%;}
    </style>
    <form class="layui-form layui-form-pane1" method="post" enctype="multipart/form-data">
        <table class="layui-table">
            <tr>
                <td style="text-align: center;width: 12%">快车/城际 - 司机手机号码<br/><br/>（<span style="color: red">测试号码</span>）</td>
                <td style="vertical-align: middle">
                    <textarea name="driver_str" id="driver_str" class="layui-textarea" style="width: 500px;" placeholder="请输入司机手机号码,英文逗号隔开;例如：13966793212,13966362532"><?php echo $whiteList['driver_phone'];?></textarea>
                </td>
            </tr>
            <tr>
                <td style="text-align: center;">用户 - 手机号码<br/><br/>（<span style="color: red">测试号码</span>）</td>
                <td>
                    <textarea name="uid_str" id="uid_str" class="layui-textarea" style="width: 500px;" placeholder="请输入用户手机号码,英文逗号隔开;例如：13966793212,13966362532"><?php echo $whiteList['user_phone'];?></textarea>
                </td>
            </tr>
            <tr>
                <td style="text-align: center;">顺风车 - 司机手机号码<br/><br/>（<span style="color: red">测试号码</span>）</td>
                <td>
                    <textarea name="fr_driver_str" id="fr_driver_str" class="layui-textarea" style="width: 500px;" placeholder="请输入顺风车司机手机号码,英文逗号隔开;例如：13966793212,13966362532"><?php echo $whiteList['fr_driver_phone'];?></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="padding-left: 100px;">
                    <input type="hidden" value="<?php echo $whiteList['id'];?>" name="id" id="id">
                    <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </td>
            </tr>
        </table>
    </form>
    <script>
        layui.use(['form'], function () {
            var form = layui.form;
            form.on('submit(*)', function(data){
                $.ajax({
                    url:'{:url("/admin/WhiteList/add")}',
                    async:true,
                    dataType:'json',
                    type:'POST',
                    data: $(data.form).serialize(),
                    success:function(res){
                        if(res.code==1){
                            layer.alert(res.msg, {icon: 6},function () {
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                                window.parent.location.reload()
                            });
                        }else{
                            layer.msg(res.msg,{icon: 5});
                        }
                    }
                });
                return false;
            });
        });
        //验证只能输入数字
        function num(object) {
            var value   = object.value;
            var id      = object.id;
            if (isNaN(value)){
                layer.msg('请输入正确的数字',{icon: 5});
                $("#"+id).val('');
                return false;
            }
        }
    </script>
</block>
